import axios from 'axios'
import { Message, MessageBox } from 'element-ui'


// 创建axios实例
const service = axios.create({
  baseURL: 'http://dev.solarpv.top/api/', // api的base_url
  timeout: 50000 ,// 请求超时时间
})

// request拦截器
service.interceptors.request.use(config => {
  return config
}, error => {
  // Do something with request error
  console.log(error) // for debug
  Promise.reject(error)
})

// respone拦截器
service.interceptors.response.use(
  response => {
    console.log("response",response);
    return response
  },
  error => {
    console.log("error",error);
    return Promise.reject(rej)
  }
);
//获取服务器时间
export function getServiceDateTime() {
  return service({
    url:'/service/common/dateTime',
    method:'get',
  })
}


